import { roleIndex } from '@/services/sys/role';
import { TableCustom } from '@vh-admin/pro-components';
import { columnsFn } from './define';
import access from '@/access';
const { checkPermissionAuth } = access();

function Users() {
  return (
    <>
      <TableCustom<any>
        request={roleIndex}
        columns={columnsFn()}
        headerTitleConfig={{
          create: {
            auth: () => {
              return checkPermissionAuth({ accessId: 12 });
            },
            text: '新增用户',
            modalConfig: {
              modalType: 'Form',
              edit: false,
              config: {
                title: '新增用户',
                submitRequest: roleIndex,
              },
            },
          },
        }}
        operationConfig={{
          edit: {
            auth: () => {
              return checkPermissionAuth({ accessId: 12 });
            },
            modalConfig: {
              modalType: 'Form',
              edit: true,
              config: {
                title: '编辑用户',
                submitRequest: roleIndex,
              },
            },
          },
          delete: {
            auth: () => {
              return checkPermissionAuth({ accessId: 12 });
            },
            modalConfig: {
              modalType: 'Delete',
              edit: true,
              config: {
                title: '删除用户',
                submitRequest: roleIndex,
              },
            },
          },
        }}
      />
    </>
  );
}

export default Users;
